#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    int n;
    cin >> n;
    int a[n+1];
    for (int i=1; i<=n; i++)
        cin >> a[i];
    sort(a+1, a+n+1);
    int w=1, k=0, s=0;
    for (int i=n-1; i>=1; i--){
        if (a[i] == a[i+1])
            ++w;
        else{
            int p=min(w, k);
            w -= p;
            s += w;
            k += w;
            w = 1;
        }
    }
    cout << s + max(w-k, 0ll) << '\n';
    return 0;
}
